
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>跨域测试</title>
</head>
<link type="test/css" href="css/style.css" rel="stylesheet">
<script type="text/javascript" th:src="@{/js/jquery-3.5.0.js}"></script>
<script type="text/javascript">
    $(function(){
        $("#GetCors").click(
            function(){
                $.ajax({
                    type: "GET",
                    url:"http://127.0.0.1:8080/rest/receive03?time=2020-03-08 12:00:00",
                    success:function(data){
                        console.log("start")
                        console.log(data)
                        alert(data);
                    }
                })
            });
    });
    $(function(){
        $("#PostCors").click(
            function(){
                $.ajax({
                    type: "POST",
                    url:"http://127.0.0.1:8080/rest/receive06",
                    data: ('{"localDateTime":"2020-03-08 12:00:00"}'),
                    contentType: "application/json",
                    dataType: "json",
                    success:function(data){
                        console.log("start")
                        console.log(data)
                        alert(JSON.stringify(data));
                    }
                })
            });
    });
</script>
<body>
<input type="button" id="GetCors" value="GetCore跨域测试" />
<input type="button" id="PostCors" value="PostCore跨域测试" />
</body>
</html>